In a typical application architecture of a virtual machine, a virtual machine manager (VMM) providing a function of managing a virtual machine is installed on a physical host. The VMM manages one or more virtual machines, and each virtual machine can run an operating system (OS) and various applications. Generally, hardware of the physical host mainly includes: some hardware related to running of a virtual machine, for example, a central processing unit (CPU), a memory, and a hard disk, and some hardware with relatively independent functions that is not directly configured to run a virtual machine but is configured to execute some particular services, for example, a Peripheral Component Interconnect Express (PCIE) device (such as a network adapter and a video card) of the physical host.
Single-root I/O virtualization (SR-IOV) is an input/output (I/O) virtualization technology. With the technology, multiple virtual PCIE adapters can be obtained by means of virtualization on a physical PCIE adapter. This is referred to as a virtual function (VF). Using a network adapter that supports the SR-IOV as an example, multiple virtual network adapters can be obtained by means of virtualization on a physical network adapter, and a VF of each virtual machine is corresponding to one virtual network adapter.
After being virtualized, a server can easily implement live migration of a virtual machine. A live migration technology for a virtual machine refers to that a virtual machine is transferred from one physical host to another physical host by means of live migration, and service processing is slightly affected in the migration process.
In a process of implementing the present disclosure, the inventor finds that the prior art has at least the following problems:
In the prior art, during live migration of a virtual machine, data stored in a memory needs to be migrated to a destination physical host, and statuses of registers saved in a PCIE adapter also need to be migrated to the destination physical host. These registers are generally configured to record working information of services processed by the PCIE adapter. The working information is used for service statistics collection, service control, and service status recording. However, the registers that save the working information of the services are extremely decentralized. If live migration is performed, the statuses of these registers need to be saved and restored individually, causing much trouble.